<?php
/**
 * CreateTime: 2022/5/7 16:18
 */

namespace App\Models\Tools;

use App\Consts\TableConsts\TableConsts;
use Illuminate\Database\Eloquent\Model;

class DelayDateModel extends Model
{
    protected $table = TableConsts::CY_DELAY_DATE_TABLE_NAME;
    public function getTableName(){
        return $this->m_cHelper->gfGetTableName($this->table)	;
    }
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->m_cHelper = app()->gcHelper;
        $this->cdb = (app()->gcHelper->m_cDb)();
    }

    public function addDelayDate($delayDate,$helper){
        return $this->cdb->insertByArray(
            $this->getTableName(),
            [
                "delay_date_start" => $helper->gfGetCurrentLocalDate(),
                "delay_date_end" =>  $helper->gfGetCurrentLocalDate($delayDate['delay_date_end']),
                "pid" => $delayDate['pid'],
                "owner_id" => $helper->gfGetCurrentStaffInfo()->staff_id				,
                "delay_type" =>  $delayDate['delay_type']
            ]
        )->getLastInsertId();
    }





}